﻿var appName = "OSharpApp";
angular.module(appName, ["kendo.directives"]).controller("app.admin.store.stockinglogs", ["$rootScope", "$scope", function ($rootScope, $scope) {
    $scope.title = "入库记录信息列表";
    $scope.gridOptions = $.osharp.kendo.grid.Options({
        url: {
            read: "/admin/stockinglogs/read",
            create: "/admin/stockinglogs/create",
            update: "/admin/stockinglogs/update",
            destroy: "/admin/stockinglogs/delete"
        },
        model: {
            id: "Id",
            fields: {
                Id: { type: "number", editable: false },
                Count: { type: "number", validation: { min: 1 } },
                Remark: { type: "string" },
                ProductId: { type: "number" },
                ProductName: { type: "string" },
                CreatedTime: { type: "date", editable: false }
            }
        },
        columns: [
            { command: [{ name: "edit", text: { edit: "", update: "", cancel: "" } }, { name: "destroy", text: "" }], width: 100 },
            { field: "Id", title: "编号", width: 75 },
            {
                field: "ProductId",
                title: "产品",
                editor: function (container, options) {
                    $.osharp.kendo.grid.RemoteDropDownListEditor(container, options, "/admin/products/node-read", "ProductName", "ProductId");
                },
                template: "#=ProductName#"
            },
            { field: "Count", title: "入库数量" },
            { field: "Remark", title: "备注" },
            { field: "CreatedTime", title: "添加时间", format: "{0: yyyy-MM-dd HH:mm}" }
        ],
        toolbar: ["create"],
        editable: { mode: "inline" }
    });
}]);